<template>
  <div class="app-container">
<!--    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">-->
<!--      <el-form-item label="分类id" prop="categoryId">-->
<!--        <el-input-->
<!--          v-model="queryParams.categoryId"-->
<!--          placeholder="请输入分类id"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="分类名称" prop="categoryName">-->
<!--        <el-input-->
<!--          v-model="queryParams.categoryName"-->
<!--          placeholder="请输入分类名称"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="第一分类id" prop="firstCid">-->
<!--        <el-input-->
<!--          v-model="queryParams.firstCid"-->
<!--          placeholder="请输入第一分类id"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="是否有库存" prop="inStock">-->
<!--        <el-input-->
<!--          v-model="queryParams.inStock"-->
<!--          placeholder="请输入是否有库存"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="价格" prop="price">-->
<!--        <el-input-->
<!--          v-model="queryParams.price"-->
<!--          placeholder="请输入价格"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="销量" prop="sales">-->
<!--        <el-input-->
<!--          v-model="queryParams.sales"-->
<!--          placeholder="请输入销量"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="第二分类id" prop="secondCid">-->
<!--        <el-input-->
<!--          v-model="queryParams.secondCid"-->
<!--          placeholder="请输入第二分类id"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="第三分类id" prop="thirdCid">-->
<!--        <el-input-->
<!--          v-model="queryParams.thirdCid"-->
<!--          placeholder="请输入第三分类id"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="标题" prop="title">-->
<!--        <el-input-->
<!--          v-model="queryParams.title"-->
<!--          placeholder="请输入标题"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="品牌id" prop="brandId">-->
<!--        <el-input-->
<!--          v-model="queryParams.brandId"-->
<!--          placeholder="请输入品牌id"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="品牌名中文" prop="brandNameCn">-->
<!--        <el-input-->
<!--          v-model="queryParams.brandNameCn"-->
<!--          placeholder="请输入品牌名中文"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="品牌名英文" prop="brandNameEn">-->
<!--        <el-input-->
<!--          v-model="queryParams.brandNameEn"-->
<!--          placeholder="请输入品牌名英文"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="评论数量" prop="commentNum">-->
<!--        <el-input-->
<!--          v-model="queryParams.commentNum"-->
<!--          placeholder="请输入评论数量"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="评分" prop="commentScore">-->
<!--        <el-input-->
<!--          v-model="queryParams.commentScore"-->
<!--          placeholder="请输入评分"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="${comment}" prop="couponPrice">-->
<!--        <el-input-->
<!--          v-model="queryParams.couponPrice"-->
<!--          placeholder="请输入${comment}"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="${comment}" prop="postFree">-->
<!--        <el-input-->
<!--          v-model="queryParams.postFree"-->
<!--          placeholder="请输入${comment}"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="佣金比例" prop="kolNum">-->
<!--        <el-input-->
<!--          v-model="queryParams.kolNum"-->
<!--          placeholder="请输入佣金比例"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="订单数量" prop="orderNum">-->
<!--        <el-input-->
<!--          v-model="queryParams.orderNum"-->
<!--          placeholder="请输入订单数量"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="浏览量" prop="viewNum">-->
<!--        <el-input-->
<!--          v-model="queryParams.viewNum"-->
<!--          placeholder="请输入浏览量"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="${comment}" prop="cosFee">-->
<!--        <el-input-->
<!--          v-model="queryParams.cosFee"-->
<!--          placeholder="请输入${comment}"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="${comment}" prop="cosRatio">-->
<!--        <el-input-->
<!--          v-model="queryParams.cosRatio"-->
<!--          placeholder="请输入${comment}"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="${comment}" prop="kolCosFee">-->
<!--        <el-input-->
<!--          v-model="queryParams.kolCosFee"-->
<!--          placeholder="请输入${comment}"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="${comment}" prop="kolCosRatio">-->
<!--        <el-input-->
<!--          v-model="queryParams.kolCosRatio"-->
<!--          placeholder="请输入${comment}"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="专向链接" prop="isAssured">-->
<!--        <el-input-->
<!--          v-model="queryParams.isAssured"-->
<!--          placeholder="请输入专向链接"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="${comment}" prop="sharable">-->
<!--        <el-input-->
<!--          v-model="queryParams.sharable"-->
<!--          placeholder="请输入${comment}"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="店铺id" prop="shopId">-->
<!--        <el-input-->
<!--          v-model="queryParams.shopId"-->
<!--          placeholder="请输入店铺id"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="店铺名称" prop="shopName">-->
<!--        <el-input-->
<!--          v-model="queryParams.shopName"-->
<!--          placeholder="请输入店铺名称"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="${comment}" prop="hasDouinGoodsTag">-->
<!--        <el-input-->
<!--          v-model="queryParams.hasDouinGoodsTag"-->
<!--          placeholder="请输入${comment}"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="发货说明" prop="logisticsInfo">-->
<!--        <el-input-->
<!--          v-model="queryParams.logisticsInfo"-->
<!--          placeholder="请输入发货说明"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="${comment}" prop="originCosFee">-->
<!--        <el-input-->
<!--          v-model="queryParams.originCosFee"-->
<!--          placeholder="请输入${comment}"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="${comment}" prop="topCosFee">-->
<!--        <el-input-->
<!--          v-model="queryParams.topCosFee"-->
<!--          placeholder="请输入${comment}"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="${comment}" prop="fav">-->
<!--        <el-input-->
<!--          v-model="queryParams.fav"-->
<!--          placeholder="请输入${comment}"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item>-->
<!--        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>-->
<!--        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>-->
<!--      </el-form-item>-->
<!--    </el-form>-->

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['system:dydetail:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['system:dydetail:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['system:dydetail:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['system:dydetail:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" border :data="dydetailList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="商品id" align="center" prop="productId" />
      <el-table-column label="分类id" align="center" prop="categoryId" />
      <el-table-column label="分类名称" align="center" prop="categoryName" />
      <el-table-column label="封面" align="center" prop="cover" />
      <el-table-column label="详情url" align="center" prop="detailUrl" />
      <el-table-column label="第一分类id" align="center" prop="firstCid" />
      <el-table-column label="图片集合" align="center" prop="imgs" />
      <el-table-column label="是否有库存" align="center" prop="inStock" />
      <el-table-column label="价格" align="center" prop="price" />
      <el-table-column label="销量" align="center" prop="sales" />
      <el-table-column label="第二分类id" align="center" prop="secondCid" />
      <el-table-column label="第三分类id" align="center" prop="thirdCid" />
      <el-table-column label="标题" align="center" prop="title" />
      <el-table-column label="品牌id" align="center" prop="brandId" />
      <el-table-column label="品牌名中文" align="center" prop="brandNameCn" />
      <el-table-column label="品牌名英文" align="center" prop="brandNameEn" />
      <el-table-column label="评论数量" align="center" prop="commentNum" />
      <el-table-column label="评分" align="center" prop="commentScore" />
      <el-table-column label="佣金比例" align="center" prop="kolNum" />
      <el-table-column label="订单数量" align="center" prop="orderNum" />
      <el-table-column label="浏览量" align="center" prop="viewNum" />
      <el-table-column label="专向链接" align="center" prop="isAssured" />
      <el-table-column label="店铺id" align="center" prop="shopId" />
      <el-table-column label="店铺名称" align="center" prop="shopName" />
      <el-table-column label="店铺评分json" align="center" prop="shopTotalScore" />
      <el-table-column label="发货说明" align="center" prop="logisticsInfo" />
      <el-table-column label="商品详情图链接" align="center" prop="detail" />
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['system:dydetail:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['system:dydetail:remove']"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改抖音商品详情对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="分类id" prop="categoryId">
          <el-input v-model="form.categoryId" placeholder="请输入分类id" />
        </el-form-item>
        <el-form-item label="分类名称" prop="categoryName">
          <el-input v-model="form.categoryName" placeholder="请输入分类名称" />
        </el-form-item>
        <el-form-item label="封面" prop="cover">
          <el-input v-model="form.cover" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="详情url" prop="detailUrl">
          <el-input v-model="form.detailUrl" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="第一分类id" prop="firstCid">
          <el-input v-model="form.firstCid" placeholder="请输入第一分类id" />
        </el-form-item>
        <el-form-item label="图片集合" prop="imgs">
          <el-input v-model="form.imgs" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="是否有库存" prop="inStock">
          <el-input v-model="form.inStock" placeholder="请输入是否有库存" />
        </el-form-item>
        <el-form-item label="价格" prop="price">
          <el-input v-model="form.price" placeholder="请输入价格" />
        </el-form-item>
        <el-form-item label="销量" prop="sales">
          <el-input v-model="form.sales" placeholder="请输入销量" />
        </el-form-item>
        <el-form-item label="第二分类id" prop="secondCid">
          <el-input v-model="form.secondCid" placeholder="请输入第二分类id" />
        </el-form-item>
        <el-form-item label="第三分类id" prop="thirdCid">
          <el-input v-model="form.thirdCid" placeholder="请输入第三分类id" />
        </el-form-item>
        <el-form-item label="标题" prop="title">
          <el-input v-model="form.title" placeholder="请输入标题" />
        </el-form-item>
        <el-form-item label="品牌id" prop="brandId">
          <el-input v-model="form.brandId" placeholder="请输入品牌id" />
        </el-form-item>
        <el-form-item label="品牌名中文" prop="brandNameCn">
          <el-input v-model="form.brandNameCn" placeholder="请输入品牌名中文" />
        </el-form-item>
        <el-form-item label="品牌名英文" prop="brandNameEn">
          <el-input v-model="form.brandNameEn" placeholder="请输入品牌名英文" />
        </el-form-item>
        <el-form-item label="评论数量" prop="commentNum">
          <el-input v-model="form.commentNum" placeholder="请输入评论数量" />
        </el-form-item>
        <el-form-item label="评分" prop="commentScore">
          <el-input v-model="form.commentScore" placeholder="请输入评分" />
        </el-form-item>
        <el-form-item label="${comment}" prop="couponPrice">
          <el-input v-model="form.couponPrice" placeholder="请输入${comment}" />
        </el-form-item>
        <el-form-item label="${comment}" prop="postFree">
          <el-input v-model="form.postFree" placeholder="请输入${comment}" />
        </el-form-item>
        <el-form-item label="佣金比例" prop="kolNum">
          <el-input v-model="form.kolNum" placeholder="请输入佣金比例" />
        </el-form-item>
        <el-form-item label="订单数量" prop="orderNum">
          <el-input v-model="form.orderNum" placeholder="请输入订单数量" />
        </el-form-item>
        <el-form-item label="浏览量" prop="viewNum">
          <el-input v-model="form.viewNum" placeholder="请输入浏览量" />
        </el-form-item>
        <el-form-item label="${comment}" prop="cosFee">
          <el-input v-model="form.cosFee" placeholder="请输入${comment}" />
        </el-form-item>
        <el-form-item label="${comment}" prop="cosRatio">
          <el-input v-model="form.cosRatio" placeholder="请输入${comment}" />
        </el-form-item>
        <el-form-item label="${comment}" prop="kolCosFee">
          <el-input v-model="form.kolCosFee" placeholder="请输入${comment}" />
        </el-form-item>
        <el-form-item label="${comment}" prop="kolCosRatio">
          <el-input v-model="form.kolCosRatio" placeholder="请输入${comment}" />
        </el-form-item>
        <el-form-item label="专向链接" prop="isAssured">
          <el-input v-model="form.isAssured" placeholder="请输入专向链接" />
        </el-form-item>
        <el-form-item label="${comment}" prop="sharable">
          <el-input v-model="form.sharable" placeholder="请输入${comment}" />
        </el-form-item>
        <el-form-item label="店铺id" prop="shopId">
          <el-input v-model="form.shopId" placeholder="请输入店铺id" />
        </el-form-item>
        <el-form-item label="店铺名称" prop="shopName">
          <el-input v-model="form.shopName" placeholder="请输入店铺名称" />
        </el-form-item>
        <el-form-item label="店铺评分json" prop="shopTotalScore">
          <el-input v-model="form.shopTotalScore" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="${comment}" prop="hasDouinGoodsTag">
          <el-input v-model="form.hasDouinGoodsTag" placeholder="请输入${comment}" />
        </el-form-item>
        <el-form-item label="发货说明" prop="logisticsInfo">
          <el-input v-model="form.logisticsInfo" placeholder="请输入发货说明" />
        </el-form-item>
        <el-form-item label="商品详情图链接" prop="detail">
          <el-input v-model="form.detail" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="${comment}" prop="originCosFee">
          <el-input v-model="form.originCosFee" placeholder="请输入${comment}" />
        </el-form-item>
        <el-form-item label="${comment}" prop="topCosFee">
          <el-input v-model="form.topCosFee" placeholder="请输入${comment}" />
        </el-form-item>
        <el-form-item label="${comment}" prop="fav">
          <el-input v-model="form.fav" placeholder="请输入${comment}" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { listDydetail, getDydetail, delDydetail, addDydetail, updateDydetail } from "@/api/system/dydetail";

export default {
  name: "Dydetail",
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 抖音商品详情表格数据
      dydetailList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        categoryId: null,
        categoryName: null,
        cover: null,
        detailUrl: null,
        firstCid: null,
        imgs: null,
        inStock: null,
        price: null,
        sales: null,
        secondCid: null,
        thirdCid: null,
        title: null,
        brandId: null,
        brandNameCn: null,
        brandNameEn: null,
        commentNum: null,
        commentScore: null,
        couponPrice: null,
        postFree: null,
        kolNum: null,
        orderNum: null,
        viewNum: null,
        presellType: null,
        commissionType: null,
        cosFee: null,
        cosRatio: null,
        kolCosFee: null,
        kolCosRatio: null,
        isAssured: null,
        sharable: null,
        shopId: null,
        shopName: null,
        shopTotalScore: null,
        hasDouinGoodsTag: null,
        logisticsInfo: null,
        detail: null,
        originCosFee: null,
        topCosFee: null,
        fav: null
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询抖音商品详情列表 */
    getList() {
      this.loading = true;
      listDydetail(this.queryParams).then(response => {
        this.dydetailList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        productId: null,
        categoryId: null,
        categoryName: null,
        cover: null,
        detailUrl: null,
        firstCid: null,
        imgs: null,
        inStock: null,
        price: null,
        sales: null,
        secondCid: null,
        thirdCid: null,
        title: null,
        brandId: null,
        brandNameCn: null,
        brandNameEn: null,
        commentNum: null,
        commentScore: null,
        couponPrice: null,
        postFree: null,
        kolNum: null,
        orderNum: null,
        viewNum: null,
        presellType: null,
        commissionType: null,
        cosFee: null,
        cosRatio: null,
        kolCosFee: null,
        kolCosRatio: null,
        isAssured: null,
        sharable: null,
        shopId: null,
        shopName: null,
        shopTotalScore: null,
        hasDouinGoodsTag: null,
        logisticsInfo: null,
        detail: null,
        originCosFee: null,
        topCosFee: null,
        fav: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.productId)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加抖音商品详情";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const productId = row.productId || this.ids
      getDydetail(productId).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改抖音商品详情";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.productId != null) {
            updateDydetail(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addDydetail(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const productIds = row.productId || this.ids;
      this.$modal.confirm('是否确认删除抖音商品详情编号为"' + productIds + '"的数据项？').then(function() {
        return delDydetail(productIds);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('system/dydetail/export', {
        ...this.queryParams
      }, `dydetail_${new Date().getTime()}.xlsx`)
    }
  }
};
</script>
